<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>{$meta_title}</title>
  
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="">
  <link rel="apple-touch-icon-precomposed" href="">
  <meta name="apple-mobile-web-app-title" content="{$meta_title}" />
  <link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/admin.css">
  
  <script type="text/javascript">var _config = <?php echo Auth::getConfig();?></script>
  <script type="text/javascript" src="__PUBLIC__/libs/dingding/javascripts/zepto.min.js"></script>
  <script type="text/javascript" src="https://g.alicdn.com/ilw/ding/0.8.9/scripts/dingtalk.js"></script>
  <script type="text/javascript" src="__PUBLIC__/libs/dingding/javascripts/logger.js"></script>
</head>
<body>
<style>
.am-btn{    border: 1px solid #ccc;    margin-bottom: 10px;}
</style>
<div class="am-cf admin-main">


<!-- content start -->
<div class="admin-content">
  <div class="admin-content-body">
   
      
<form class="am-form" id="taskform" action="/Wap/Task/addnew" method="post">
             
             <div class="am-g am-margin-top">
             <div class="am-u-sm-3 am-u-md-2 am-text-right">搜索</div>
             <div class="am-u-sm-8 am-u-md-4 am-u-end" >
	          <div class="am-input-group am-input-group-sm">
	            <input type="text" class="am-form-field" id="so_project" placeholder="请输入项目ID/名称/编号">
	          <span class="am-input-group-btn">
	            <button class="am-btn am-btn-default" type="button" id="search">搜索</button>
	          </span>
	          </div>
	        </div>
             </div>
             
			  <div class="am-g am-margin-top">
	            <div class="am-u-sm-3 am-u-md-2 am-text-right">项目编号</div>
	            <div class="am-u-sm-8 am-u-md-4 am-u-end ">
	              <select name="projectid" id="projectid">
	              	<volist name="project_number" id="vo" key="k">
	                <option value="{$vo.id}">{$vo.title}</option>
	                </volist>
	              </select>
	            </div>
	          </div>

            <div class="am-g am-margin-top">
              <div class="am-u-sm-3 am-u-md-2 am-text-right">
                负责人
              </div>
              <div class="am-u-sm-8 am-u-md-10 am-u-end col-end">
              	
              
	            <button class="am-btn am-btn-default" type="button" id="find_uid">选人</button>
	         
               
              </div>
            </div>

			<div class="am-g am-margin-top">
	            <div class="am-u-sm-3 am-u-md-2 am-text-right">类型</div>
	            <div class="am-u-sm-8 am-u-md-4 am-u-end ">
	              <select name="type">
	                <volist name="task_type" id="vo" key="k">
	                <option value="{$vo.id}">{$vo.title}</option>
	                </volist>
	              </select>
	            </div>
	          </div>
	          
	          <div class="am-g am-margin-top">
	            <div class="am-u-sm-3 am-u-md-2 am-text-right">紧急级别</div>
	            <div class="am-u-sm-8 am-u-md-4 am-u-end ">
	              <select name="emergency_level">
	                <volist name="emergency_level" id="vo" key="k">
	                <option value="{$vo.id}">{$vo.title}</option>
	                </volist>
	              </select>
	            </div>
	          </div>
               
             <div class="am-g am-margin-top">
              <div class="am-u-sm-3 am-u-md-2 am-text-right">
                发布人
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                <input type="text" class="am-input-sm"  value="{$user_info.name}" disabled="disabled">
                <input type="hidden"  name="creater" value="{$user_info.userid}">
              </div>
            </div>     

            <div class="am-g am-margin-top-sm">
              <div class="am-u-sm-12 am-u-md-2 am-text-right admin-form-text">
                任务内容
              </div>
              <div class="am-u-sm-12 am-u-md-6 am-u-end">
                <textarea rows="4" name="content" placeholder="请填写任务详细"></textarea>
              </div>
            </div>

          </form>
   
	<div class="am-margin">
      <button type="button" class="am-btn am-btn-primary am-btn-xs" id="savetask">提交保存</button>
      <button type="button" class="am-btn am-btn-primary am-btn-xs" onClick="javascript :history.back(-1);">放弃保存</button>
    </div>
<div style="height:60px;"></div>
  </div>
</div>
<!-- content end -->

</div>

<script type="text/javascript" >

//搜索项目
$('#search').click(function(){
	var keyword=$('#so_project').val();
	var params = {};
	params.keyword=keyword;
	
	var url="{:U('Wap/Task/getProjectAjax')}";
	$.post(url,params,function(data) {
		
			$('#projectid').html(data);
		
	});
});
//选人
 dd.config({
            agentId: _config.agentId,
            corpId: _config.corpId,
            timeStamp: _config.timeStamp,
            nonceStr: _config.nonceStr,
            signature: _config.signature,
            jsApiList: [
            	'runtime.permission.requestAuthCode',
                'runtime.info',
                'device.base.getUUID',
                'device.notification.prompt',
                'device.base.getInterface',
                'biz.chat.pickConversation',
                'device.notification.confirm',
                'device.notification.alert',
                'device.notification.prompt',
                'biz.chat.open',
                'biz.util.open',
                'biz.user.get',
                'biz.contact.choose',
                'biz.telephone.call',
                'biz.ding.post',
                'ui.pullToRefresh.enable',
                'biz.navigation.setRight'
                ]
        });
 dd.ready(function() {
	//禁用下拉刷新
		dd.ui.pullToRefresh.disable();
		//右侧
		dd.biz.navigation.setRight({
		    show: true,//控制按钮显示， true 显示， false 隐藏， 默认true
		    control: true,//是否控制点击事件，true 控制，false 不控制， 默认false
		    text: '列表',//控制显示文本，空字符串表示显示默认文本
		    onSuccess : function(result) {
		    	window.location.href='/Wap/Task/mytask';
		        //如果control为true，则onSuccess将在发生按钮点击事件被回调
		        /*
		        {}
		        */
		    },
		    onFail : function(err) {}
		});
		 $('#find_uid').on('click', function() {
		 	var lens = 5;
			var user=[];
	     	for (var a = 1; a <= lens; a++)
	     	{
	     		if($('#uid'+a).val()){
	     			user[a-1] =$('#uid'+a).val();
	     		}
	     		
	     	} 
				dd.biz.contact.choose({
				  startWithDepartmentId: 0, //-1表示打开的通讯录从自己所在部门开始展示, 0表示从企业最上层开始，(其他数字表示从该部门开始:暂时不支持)
				  multiple: true, //是否多选： true多选 false单选； 默认true
				  users: user, //默认选中的用户列表，userid；成功回调中应包含该信息
				  disabledUsers:[],// 不能选中的用户列表，员工userid
				  corpId: _config.corpId, //企业id
				  max: 5, //人数限制，当multiple为true才生效，可选范围1-1500
				  limitTips:"超过限制人数", //超过人数限制的提示语可以用这个字段自定义
				  isNeedSearch: true, // 是否需要搜索功能
				  title : "选人", // 如果你需要修改选人页面的title，可以在这里赋值 
				  local:false, // 是否显示本地联系人，默认false
				  onSuccess: function(data) {
				  //onSuccess将在选人结束，点击确定按钮的时候被回调
					var len = 5;
	            	for (var i = 1; i <= len; i++)
	            	{
	            		$('#user_'+i).remove();
	            		var html ="<div class='am-btn' id='user_"+i+"'>"+data[i-1].name+"<span onclick='del_user("+i+");'>X</span><input type='hidden' name='uid"+i+"' id='uid"+i+"' value='"+data[i-1].emplId+"'></div>"
	            		$('#find_uid').before(html); 
	            	} 
				 
				  },
				  onFail : function(err) {}
				});
		 });

 
 });
 
 
 function del_user(i){
	 $('#user_'+i).remove();
 }
//提交表单
	$('#savetask').click(function(){
	 	$('#taskform').submit();
	});
</script>

<!-- footnav start --> 
<style>
.footnav{ position: fixed;  bottom: 0;    width: 100% ; background: #fff; z-index:999999}
.footnav ul{ padding:5px 0; border-top:1px solid #ccc}
.footnav ul li{ width:20%; float:left;list-style-type: none;}
.footnav ul li a{ display:block; text-align:center; font-size:12px;    color: #767171;}
.footnav ul li a span{ font-size:24px;line-height: 20px;}
.active a {color:#0e90d2 !important;}

</style>
<div class=" footnav">
    <ul>
    <li > <a  href="/Wap/Index/shouye" ><span class="am-icon-home"></span>首页 </a> </li>
     <li class="active"><a href="/Wap/Task/mytask"><span class="am-icon-file-text"></span>任务</a></li>
      <li ><a href="/Wap/Server/index"><span class="am-icon-recycle"></span> 服务器</a></li>
      <li ><a href="/Wap/Customer/index"><span class="am-icon-user-md"></span>客户</a></li> 
      <li ><a href="/Wap/Project/index"><span class="am-icon-briefcase"></span>项目</a></li>
    </ul>
    
</div>
<!-- footnav end -->

<script src="__ROOT__/Application/Home/View/default/assets/js/jquery.min.js"></script>

<script src="__ROOT__/Application/Home/View/default/assets/js/amazeui.min.js"></script>
<script src="__ROOT__/Application/Home/View/default/assets/js/app.js"></script>
</body>
</html>
